package net.lab1024.sa.admin.module.system.config;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.admin.module.system.config.domain.vo.SystemConfigDefaultVO;
import net.lab1024.sa.admin.module.system.config.domain.vo.SystemConfigPainetBoxVO;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


@RestController
@Tag(name = AdminSwaggerTagConst.System.SYSTEM_CONFIG)
public class SystemConfigController {

    private final SystemConfigService systemConfigService;

    public SystemConfigController(SystemConfigService systemConfigService) {
        this.systemConfigService = systemConfigService;
    }

    @PostMapping("/system/config/save/{prefix}")
    @Operation(summary = "保存配置")
    public ResponseDTO<String> save(@PathVariable String prefix, @RequestBody Map<String, Object> params) {
        return systemConfigService.save(prefix, params);
    }

    @GetMapping("/system/config/getDefault")
    @Operation(summary = "获取默认配置")
    public ResponseDTO<SystemConfigDefaultVO> getDefault() {
        return systemConfigService.getDefault();
    }

    @GetMapping("/system/config/getPainetBox")
    @Operation(summary = "获取派盒子配置")
    public ResponseDTO<SystemConfigPainetBoxVO> getPainetBox() {
        return systemConfigService.getPainetBox();
    }
}
